using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Entities;
using BUS;
public partial class Detail : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            loadData();
        }
    }

    private void loadData()
    {
        int id =int.Parse ( Request.QueryString["id"].ToString ());
        tbSanPham sanPham = tbSanPhamBUS.GetId(id);
        lit_tensp.Text = sanPham.MoTa ;
        int Id = 0;
        int MaHA = tbHinhAnhBUS.FirstImage(int.Parse(sanPham.IdSanPham.ToString()), Id);
        if (MaHA > 0)
        {
            tbHinhAnh hinhAnh = tbHinhAnhBUS.GetById(MaHA);
            img_hinh .ImageUrl = "~/Photos/" + hinhAnh.TenHinh.ToString();
        }
        else
        {
            img_hinh.ImageUrl = "~/Photos/no_images.jpg";
        }
    }
}
